package com.mxw.account.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Description TODO
 * @Author RingKo
 * @Date 2021/8/23 22:15
 * @Version 1.0
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AccountDTO {

    @Excel(name = "accountCode")
    private String accountCode;

    @Excel(name = "accountName")
    @NotNull(message = "[账户名称]不能为空")
    private String accountName;

    @Excel(name = "amount")
    @Digits(integer = 4, fraction = 0, message = "Invalid or malformed invoice amount")
    @DecimalMax(value = "30", message = "amount should be between 0 and 30")
    @DecimalMin(value = "0", message = "amount should be between 0 and 30")
    @NotNull(message = "金额不能为空")
    private BigDecimal amount;

    @Excel(name = "id")
    @Max(value = 20, message = "id不能超过20")
    private Long id;

    @Range(min = 1, max = 360, message = "Term days should be between 1 and 360")
    @Digits(integer = 18, fraction = 0, message = "Term days must be an integer")
    private Double termDays;

    @JsonFormat(pattern = "yyyy-MM", timezone="GMT+8")
    private Date createdAt;
}
